/*
 Navicat Premium Data Transfer

 Source Server         : mysql
 Source Server Type    : MySQL
 Source Server Version : 50718
 Source Host           : localhost
 Source Database       : test_dm

 Target Server Type    : MySQL
 Target Server Version : 50718
 File Encoding         : utf-8

 Date: 10/15/2019 17:22:59 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `dm_di_sales`
-- ----------------------------
DROP TABLE IF EXISTS `dm_di_sales`;
CREATE TABLE `dm_di_sales` (
  `id` int(11) NOT NULL COMMENT '订单ID',
  `order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `trade_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `bar_code` varchar(50) DEFAULT NULL,
  `sku_code` varchar(50) DEFAULT NULL,
  `sku_name` varchar(100) DEFAULT NULL,
  `product_code` varchar(50) DEFAULT NULL,
  `product_name` varchar(100) DEFAULT NULL,
  `platform_id` bigint(20) DEFAULT NULL COMMENT '平台ID',
  `platform_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `platform_name` char(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `store_id` bigint(20) DEFAULT NULL COMMENT '店铺ID',
  `store_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `store_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `trade_from` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '来源，移动orPC',
  `trans_date` datetime DEFAULT NULL COMMENT '交易日期',
  `pay_date` datetime DEFAULT NULL COMMENT '付款日期',
  `convert_date` datetime DEFAULT NULL COMMENT '转换日期',
  `cost_price` decimal(10,5) DEFAULT NULL COMMENT '成本价',
  `cost_fee` decimal(10,5) DEFAULT NULL COMMENT '成本金额',
  `discount_amount` decimal(10,5) DEFAULT NULL COMMENT '折扣数额',
  `amount_actual` decimal(15,5) DEFAULT NULL COMMENT '实付金额',
  `amount` decimal(10,5) DEFAULT NULL COMMENT '总金额',
  `quantity` int(11) DEFAULT NULL COMMENT '数量',
  `category_id` bigint(20) DEFAULT NULL,
  `category_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `category_name` varchar(100) DEFAULT NULL,
  `category_pid` bigint(20) DEFAULT NULL,
  `category_pcode` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `category_pname` varchar(100) DEFAULT NULL,
  `brand_id` int(11) DEFAULT NULL COMMENT '品牌',
  `brand_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `sku_cost_price` decimal(10,5) DEFAULT NULL COMMENT 'sku标准成本价',
  `spec_code` varchar(50) DEFAULT NULL COMMENT '规格代码',
  `spec_name` varchar(100) DEFAULT NULL COMMENT '规格名称',
  `buyer_nick` varchar(100) DEFAULT NULL,
  `oms_order_status` varchar(50) DEFAULT NULL,
  `static_y` char(4) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `static_m` char(2) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `static_d` char(2) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `static_date` date NOT NULL COMMENT '业务时间',
  `insertdate` datetime DEFAULT NULL,
  PRIMARY KEY (`static_date`,`id`),
  KEY `idx_category1` (`category_code`),
  KEY `idx_store` (`store_code`),
  KEY `idx_product` (`product_code`),
  KEY `idx_sku` (`sku_code`),
  KEY `idx_trade_id` (`trade_id`),
  KEY `Index_insertdate` (`insertdate`),
  KEY `idx_static_date` (`static_date`),
  KEY `i_b_s_p_b_s` (`brand_id`,`store_id`,`product_code`,`bar_code`,`static_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
/*!50500 PARTITION BY RANGE  COLUMNS(static_date)
(PARTITION sales201305 VALUES LESS THAN ('2013-06-01') ENGINE = MyISAM,
 PARTITION sales201306 VALUES LESS THAN ('2013-07-01') ENGINE = MyISAM,
 PARTITION sales201307 VALUES LESS THAN ('2013-08-01') ENGINE = MyISAM,
 PARTITION sales201308 VALUES LESS THAN ('2013-09-01') ENGINE = MyISAM,
 PARTITION sales201309 VALUES LESS THAN ('2013-10-01') ENGINE = MyISAM,
 PARTITION sales201310 VALUES LESS THAN ('2013-11-01') ENGINE = MyISAM,
 PARTITION sales201311 VALUES LESS THAN ('2013-12-01') ENGINE = MyISAM,
 PARTITION sales201312 VALUES LESS THAN ('2014-01-01') ENGINE = MyISAM,
 PARTITION sales201401 VALUES LESS THAN ('2014-02-01') ENGINE = MyISAM,
 PARTITION sales201402 VALUES LESS THAN ('2014-03-01') ENGINE = MyISAM,
 PARTITION sales201403 VALUES LESS THAN ('2014-04-01') ENGINE = MyISAM,
 PARTITION sales201404 VALUES LESS THAN ('2014-05-01') ENGINE = MyISAM,
 PARTITION sales201405 VALUES LESS THAN ('2014-06-01') ENGINE = MyISAM,
 PARTITION sales201406 VALUES LESS THAN ('2014-07-01') ENGINE = MyISAM,
 PARTITION sales201407 VALUES LESS THAN ('2014-08-01') ENGINE = MyISAM,
 PARTITION sales201408 VALUES LESS THAN ('2014-09-01') ENGINE = MyISAM,
 PARTITION sales201409 VALUES LESS THAN ('2014-10-01') ENGINE = MyISAM,
 PARTITION sales201410 VALUES LESS THAN ('2014-11-01') ENGINE = MyISAM,
 PARTITION sales201411 VALUES LESS THAN ('2014-12-01') ENGINE = MyISAM,
 PARTITION sales201412 VALUES LESS THAN ('2015-01-01') ENGINE = MyISAM,
 PARTITION sales201501 VALUES LESS THAN ('2015-02-01') ENGINE = MyISAM,
 PARTITION sales201502 VALUES LESS THAN ('2015-03-01') ENGINE = MyISAM,
 PARTITION sales201503 VALUES LESS THAN ('2015-04-01') ENGINE = MyISAM,
 PARTITION sales201504 VALUES LESS THAN ('2015-05-01') ENGINE = MyISAM,
 PARTITION sales201505 VALUES LESS THAN ('2015-06-01') ENGINE = MyISAM,
 PARTITION sales201506 VALUES LESS THAN ('2015-07-01') ENGINE = MyISAM,
 PARTITION sales201507 VALUES LESS THAN ('2015-08-01') ENGINE = MyISAM,
 PARTITION sales201508 VALUES LESS THAN ('2015-09-01') ENGINE = MyISAM,
 PARTITION sales201509 VALUES LESS THAN ('2015-10-01') ENGINE = MyISAM,
 PARTITION sales201510 VALUES LESS THAN ('2015-11-01') ENGINE = MyISAM,
 PARTITION sales201511 VALUES LESS THAN ('2015-12-01') ENGINE = MyISAM,
 PARTITION sales201512 VALUES LESS THAN ('2016-01-01') ENGINE = MyISAM,
 PARTITION sales201601 VALUES LESS THAN ('2016-02-01') ENGINE = MyISAM,
 PARTITION sales201602 VALUES LESS THAN ('2016-03-01') ENGINE = MyISAM,
 PARTITION sales201603 VALUES LESS THAN ('2016-04-01') ENGINE = MyISAM,
 PARTITION sales201604 VALUES LESS THAN ('2016-05-01') ENGINE = MyISAM,
 PARTITION sales201605 VALUES LESS THAN ('2016-06-01') ENGINE = MyISAM,
 PARTITION sales201606 VALUES LESS THAN ('2016-07-01') ENGINE = MyISAM,
 PARTITION sales201607 VALUES LESS THAN ('2016-08-01') ENGINE = MyISAM,
 PARTITION sales201608 VALUES LESS THAN ('2016-09-01') ENGINE = MyISAM,
 PARTITION sales201609 VALUES LESS THAN ('2016-10-01') ENGINE = MyISAM,
 PARTITION sales201610 VALUES LESS THAN ('2016-11-01') ENGINE = MyISAM,
 PARTITION sales201611 VALUES LESS THAN ('2016-12-01') ENGINE = MyISAM,
 PARTITION sales201612 VALUES LESS THAN ('2017-01-01') ENGINE = MyISAM,
 PARTITION sales201701 VALUES LESS THAN ('2017-02-01') ENGINE = MyISAM,
 PARTITION sales201702 VALUES LESS THAN ('2017-03-01') ENGINE = MyISAM,
 PARTITION sales201703 VALUES LESS THAN ('2017-04-01') ENGINE = MyISAM,
 PARTITION sales201704 VALUES LESS THAN ('2017-05-01') ENGINE = MyISAM,
 PARTITION sales201705 VALUES LESS THAN ('2017-06-01') ENGINE = MyISAM,
 PARTITION sales201706 VALUES LESS THAN ('2017-07-01') ENGINE = MyISAM,
 PARTITION sales201707 VALUES LESS THAN ('2017-08-01') ENGINE = MyISAM,
 PARTITION sales201708 VALUES LESS THAN ('2017-09-01') ENGINE = MyISAM,
 PARTITION sales201709 VALUES LESS THAN ('2017-10-01') ENGINE = MyISAM,
 PARTITION sales201710 VALUES LESS THAN ('2017-11-01') ENGINE = MyISAM,
 PARTITION sales201711 VALUES LESS THAN ('2017-12-01') ENGINE = MyISAM,
 PARTITION sales201712 VALUES LESS THAN ('2018-01-01') ENGINE = MyISAM,
 PARTITION sales201801 VALUES LESS THAN ('2018-02-01') ENGINE = MyISAM,
 PARTITION sales201802 VALUES LESS THAN ('2018-03-01') ENGINE = MyISAM,
 PARTITION sales201803 VALUES LESS THAN ('2018-04-01') ENGINE = MyISAM,
 PARTITION sales201804 VALUES LESS THAN ('2018-05-01') ENGINE = MyISAM,
 PARTITION sales201805 VALUES LESS THAN ('2018-06-01') ENGINE = MyISAM,
 PARTITION sales201806 VALUES LESS THAN ('2018-07-01') ENGINE = MyISAM,
 PARTITION sales201807 VALUES LESS THAN ('2018-08-01') ENGINE = MyISAM,
 PARTITION sales201808 VALUES LESS THAN ('2018-09-01') ENGINE = MyISAM,
 PARTITION sales201809 VALUES LESS THAN ('2018-10-01') ENGINE = MyISAM,
 PARTITION sales201810 VALUES LESS THAN ('2018-11-01') ENGINE = MyISAM,
 PARTITION sales201812 VALUES LESS THAN ('2019-01-01') ENGINE = MyISAM,
 PARTITION sales201901 VALUES LESS THAN ('2019-02-01') ENGINE = MyISAM,
 PARTITION sales201902 VALUES LESS THAN ('2019-03-01') ENGINE = MyISAM,
 PARTITION sales201903 VALUES LESS THAN ('2019-04-01') ENGINE = MyISAM,
 PARTITION sales201904 VALUES LESS THAN ('2019-05-01') ENGINE = MyISAM,
 PARTITION sales201905 VALUES LESS THAN ('2019-06-01') ENGINE = MyISAM,
 PARTITION sales201906 VALUES LESS THAN ('2019-07-01') ENGINE = MyISAM,
 PARTITION sales201907 VALUES LESS THAN ('2019-08-01') ENGINE = MyISAM,
 PARTITION sales201908 VALUES LESS THAN ('2019-09-01') ENGINE = MyISAM,
 PARTITION sales201909 VALUES LESS THAN ('2019-10-01') ENGINE = MyISAM,
 PARTITION sales201910 VALUES LESS THAN ('2019-11-01') ENGINE = MyISAM,
 PARTITION sales201911 VALUES LESS THAN ('2019-12-01') ENGINE = MyISAM,
 PARTITION sales201912 VALUES LESS THAN ('2020-01-01') ENGINE = MyISAM,
 PARTITION sales202001 VALUES LESS THAN ('2020-02-01') ENGINE = MyISAM,
 PARTITION sales202002 VALUES LESS THAN ('2020-03-01') ENGINE = MyISAM,
 PARTITION sales202003 VALUES LESS THAN ('2020-04-01') ENGINE = MyISAM,
 PARTITION sales202004 VALUES LESS THAN ('2020-05-01') ENGINE = MyISAM,
 PARTITION sales202005 VALUES LESS THAN ('2020-06-01') ENGINE = MyISAM,
 PARTITION sales202006 VALUES LESS THAN ('2020-07-01') ENGINE = MyISAM,
 PARTITION sales202007 VALUES LESS THAN ('2020-08-01') ENGINE = MyISAM,
 PARTITION sales202008 VALUES LESS THAN ('2020-09-01') ENGINE = MyISAM,
 PARTITION sales202009 VALUES LESS THAN ('2020-10-01') ENGINE = MyISAM,
 PARTITION sales202010 VALUES LESS THAN ('2020-11-01') ENGINE = MyISAM,
 PARTITION sales202011 VALUES LESS THAN ('2020-12-01') ENGINE = MyISAM,
 PARTITION sales202012 VALUES LESS THAN ('2021-01-01') ENGINE = MyISAM,
 PARTITION sales202101 VALUES LESS THAN ('2021-02-01') ENGINE = MyISAM,
 PARTITION sales202102 VALUES LESS THAN ('2021-03-01') ENGINE = MyISAM,
 PARTITION sales202103 VALUES LESS THAN ('2021-04-01') ENGINE = MyISAM,
 PARTITION sales202104 VALUES LESS THAN ('2021-05-01') ENGINE = MyISAM,
 PARTITION sales202105 VALUES LESS THAN ('2021-06-01') ENGINE = MyISAM,
 PARTITION sales202106 VALUES LESS THAN ('2021-07-01') ENGINE = MyISAM,
 PARTITION sales202107 VALUES LESS THAN ('2021-08-01') ENGINE = MyISAM,
 PARTITION sales202108 VALUES LESS THAN ('2021-09-01') ENGINE = MyISAM,
 PARTITION sales202109 VALUES LESS THAN ('2021-10-01') ENGINE = MyISAM,
 PARTITION sales202110 VALUES LESS THAN ('2021-11-01') ENGINE = MyISAM,
 PARTITION sales202111 VALUES LESS THAN ('2021-12-01') ENGINE = MyISAM,
 PARTITION sales202112 VALUES LESS THAN ('2022-01-01') ENGINE = MyISAM) */;

-- ----------------------------
--  Records of `dm_di_sales`
-- ----------------------------
BEGIN;
INSERT INTO `dm_di_sales` VALUES ('2', '1', '100010110111', 'DJ000201', null, '顶级80g', 'DJ0002', '雪菊', '1', 'taobao', '淘宝平台', '2', 'tb_bencaoqj', '天猫本草旗舰店', null, '2019-10-08 16:50:00', '2019-10-08 16:50:03', '2019-10-08 16:50:09', '100.00000', '200.00000', '20.00000', '340.00000', '360.00000', '2', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', '1', '本草', '100.00000', '3', '顶级80g', 'test', '1', '2019', '10', '8', '2019-10-08', '2019-10-09 12:00:55'), ('1', '1', '100010110111', 'DJ000101', null, '杭白80g', 'DJ0001', '胎菊', '1', 'taobao', '淘宝平台', '2', 'tb_bencaoqj', '天猫本草旗舰店', null, '2019-10-08 16:50:00', '2019-10-08 16:50:03', '2019-10-08 16:50:09', '50.00000', '50.00000', '0.00000', '100.00000', '100.00000', '1', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', '1', '本草', '50.00000', '1', '杭白80g', 'test', '1', '2019', '10', '8', '2019-10-08', '2019-10-09 12:00:55');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
